package com.halopay.controler;

import com.halopay.entity.PacketDetail;
import com.halopay.service.PacketDetailService;
import com.halopay.common.utils.PageUtils;
import com.halopay.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 
 *
 * @author zx
 * @email zdkk@foxmail.com
 * @date 2019-01-18 17:13:28
 */
@RestController
@RequestMapping("sys/packetdetail")
public class PacketDetailController {
    @Autowired
    private PacketDetailService packetDetailService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = packetDetailService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
			PacketDetail packetDetail = packetDetailService.selectById(id);

        return R.ok().put("packetDetail", packetDetail);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody PacketDetail packetDetail){
			packetDetailService.insert(packetDetail);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody PacketDetail packetDetail){
			packetDetailService.updateById(packetDetail);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
			packetDetailService.deleteBatchIds(Arrays.asList(ids));

        return R.ok();
    }

}
